package cn.gok.demo18.service.impl;

import cn.gok.demo18.dao.UserDao;
import cn.gok.demo18.entity.User;
import cn.gok.demo18.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName UserServiceImpl
 * @Description TODO
 * @Author HP
 * @Date 14:43 2022/7/18
 * @Version 1.0
 **/
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;

    @Override
    public List<User> selectAllUser() {
        return userDao.selectAllUser();
    }

    @Override
    public User selectByUser(int id) {
        return userDao.selectByUser(id);
    }

    @Override
    public int addUser(User user) {
        return userDao.addUser(user);
    }

    @Override
    public int updateUser(User user) {
        return userDao.updateUser(user);
    }

    @Override
    public int deleteUser(int id) {
        return userDao.deleteUser(id);
    }

    @Override
    public String login(User user) {
        return userDao.login(user);
    }

//    @Override
//    public int register(User user) {
//        return userDao.register(user);
//    }

    @Override
    public User selectByNameAndPassword(String name,String password) {
        return userDao.selectByNameAndPassword( name,password);
    }
}
